# CLASSB\_CPU\_RegistersTest

**Function**

```c
CLASSB_TEST_STATUS CLASSB_CPU_RegistersTest(bool running_context);
```

**Summary**

This self-test checks the processor core registers of the CPU, to detect stuck-at faults.

**Description**

This self-test writes test patterns into the processor core registers, and special function registers, and read them back to detect stuck-at faults. Special function register bits which are reserved or should not be modified during the test are not written.

**Precondition**

None.

**Parameters**

*running\_context* - False for startup test. True for run-time test.

**Returns**

*CLASSB\_TEST\_STATUS* - Status of the test.

**Example**

```c
CLASSB_TEST_STATUS classb_test_status = CLASSB_TEST_NOT_EXECUTED;
// Perform run-time test of the CPU registers
classb_test_status = CLASSB_CPU_RegistersTest(true);
```

**Remarks**

This self-test can be used during startup as well as run-time. If a failure is detected, this self-test remains in an infinite loop to avoid unsafe code execution.

**Parent topic:**[MPLAB® Harmony Class B Library for PIC32MZ W1 devices](GUID-B046F97C-6BDC-45FC-BC1F-8C54B8F6F09A.md)

